#include<stdio.h>

int atoi(const char*a)
{
    int result = 0 ;
    int sign = 1 ;
    if(*a == '-')
    {
        sign = -1;
    }

    while(*a != '\0')
    {
        if(*a >= '0' && *a <= '9')
        {
            result = result * 10 + *a - '0';
        }
        a++;        
    }
    return sign * result;
}

int main()
{

    const char *s= "1234";
    int a = atoi(s);
    printf("%d\n",a);
    return 0;
}